# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=whatsmyname
pkgver=2731.fd1ce00
pkgrel=3
pkgdesc='Tool to perform user and username enumeration on various websites.'
groups=('blackarch' 'blackarch-social' 'blackarch-recon')
arch=('any')
url='https://github.com/WebBreacher/WhatsMyName'
license=('MIT')
depends=('python' 'python-requests' 'python-multidict' 'python-aiohttp'
         'python-terminaltables')
makedepends=('git')
source=("$pkgname::git+https://github.com/WebBreacher/WhatsMyName.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"

  rm *.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python whats_my_name.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

